#include "mytextedit.h"




mytextedit::mytextedit(QWidget *parent) : QTextEdit(parent)
{

}

void mytextedit::wheelEvent(QWheelEvent *event)
{
    if(KeyPress == 1){
        if(event->angleDelta().y() > 0){
            zoomIn();
        }
        else if(event->angleDelta().y() < 0){
            zoomOut();
        }
        event->accept();
    }
    else {
        QTextEdit::wheelEvent(event);
    }
}

void mytextedit::keyPressEvent(QKeyEvent *event)
{
    if(event->key() == Qt :: Key_Control){
        KeyPress = 1;
    }
    QTextEdit::keyPressEvent(event);
}

void mytextedit::keyReleaseEvent(QKeyEvent *event)
{
    if(event->key() == Qt :: Key_Control){
        KeyPress = 0;
    }
    QTextEdit::keyPressEvent(event);
}


